Skip to content

Instantly share code, notes, and snippets.

@texodus
texodus / .block
Last active May 13, 2024 19:43 — forked from JHawk/.block
Perspective NYC Citibike Example
license: apache-2.0
@ksmithut
ksmithut / .dockerignore
Last active May 13, 2024 19:41
Node Docker Compose nodemon
node_modules
@rsms
rsms / macos-distribution.md
Last active May 13, 2024 19:40
macOS distribution — code signing, notarization, quarantine, distribution vehicles
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active May 13, 2024 19:40 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@cmer
cmer / waketv.lua
Last active May 13, 2024 19:34
Wake TV when MacOS wakes from sleep (Hammerspoon)
-- -------------------------------------------------------------------
-- THIS SCRIPT IS NOW DEPRECATED IN FAVOR OF A MORE ROBUST SOLUTION --
-- Please refer to https://github.com/cmer/lg-tv-control-macos/
-- -------------------------------------------------------------------
local tv_identifier = "LG TV"
local mac_address = "aa:bb:cc:dd:ee:ff"
local tv_found = (hs.screen.find(tv_identifier) ~= nil)
local debug = false -- Set to true to enable debug messages
@kamilkrzyskow
kamilkrzyskow / performance_debug.py
Last active May 13, 2024 19:34
MkDocs hook for performance debugging
"""MkDocs hook for performance debugging
The idea behind it is to provide a minimal curated performance log for a `mkdocs build` run.
Of course anyone can use a proper profiler, but the output often contains a lot of non-critical data
that the user has to first filter to get a clearer picture. This hook takes care of this and allows
to quickly see where a bottleneck is occurring. It also has a lower overhead than a proper profiler.
It creates a file in the current working directory, it can be configured easily with variables set
at the bottom of the file. There are also the timing categories included.
@Qubadi
Qubadi / gist:07e71872af75d96f8f811306295dafee
Created May 13, 2024 15:59
Current user media access control in WordPress
Description
This PHP snippet enhances the security and organization of the WordPress media library by enforcing user-specific access controls.
It ensures that users can only view, edit, and delete their own uploaded media files, not those uploaded by others.
This functionality is particularly useful in multi-author WordPress environments where maintaining individual user
media privacy is crucial. By integrating this code, administrators can streamline media management and safeguard user
content from unauthorized access.
1. Copy this PHP snippet and paste it into your snippet editor, then save it.
2. Ensure that you have already granted the user access to the media library in WordPress before using this custom code.
@ezamelczyk
ezamelczyk / gitcount.sh
Created June 14, 2019 09:45
Git count lines by author
#!/bin/sh
git log --shortstat | grep -E "(Author: )(\b\s*([A-Z]\w+)){2}|fil(e|es) changed" | awk '
{
if($1 ~ /Author/) {
author = $2" "$3
} else {
files[author]+=$1
inserted[author]+=$4
deleted[author]+=$6
}
@dariusf
dariusf / z3proof.py
Created November 1, 2021 16:43
Visualize Z3's proofs
#!/usr/bin/env python
# Author: Darius Foo (darius.foo.tw@gmail.com)
# License: GPLv3
from z3 import *
set_param(proof=True)
s = Solver()